package com.mrper.jnindk;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    static {
        System.loadLibrary("jni");
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        setTitle(String.valueOf(add(100, 300))
                + String.valueOf(factory(6))
                + getDomainUrl());
        showToast(getDomainUrl());
        getSupportActionBar();
    }

    /**
     * 加法运算
     **/
    public native int add(int a, int b);

    /**
     * 阶乘算法
     **/
    public native int factory(int a);

    /**
     * 获取主站地址
     *
     * @return
     */
    public native String getDomainUrl();

    /**
     * 显示Toast提示框
     *
     * @param message 消息内容
     */
    public native void showToast(String message);

}
